package com.csun.cmny.provider.model.enums.sleepcare;

import com.csun.cmny.provider.model.enums.button.DmcCsunButtonBindTypeEnum;

import java.util.Arrays;
import java.util.List;

/**
 * @Auther: chisj chisj@foxmal.com
 * @Date: 2019-02-13 20:20
 * @Description: the enum dmc sleep care bind type
 */
public enum DmcSleepCareBindTypeEnum {

    /*
     * 自定义
     */
    CUSTOM(0, "自定义"),

    /**
     * 老人
     */
    OLDMAN(1, "老人"),

    /**
     * 床位
     */
    BED(2, "床位");

    /**
     * The Key.
     */
    Integer key;
    /**
     * The Value.
     */
    String value;

    DmcSleepCareBindTypeEnum(Integer key, String value) {
        this.key = key;
        this.value = value;
    }

    /**
     * Gets key.
     *
     * @return the key
     */
    public Integer getKey() {
        return key;
    }

    /**
     * Gets value.
     *
     * @return the value
     */
    public String getValue() {
        return value;
    }

    /**
     * 获取key获取value
     *
     * @param key key
     *
     * @return value value
     */
    public static String getValue(Integer key) {
        for (DmcSleepCareBindTypeEnum ele : DmcSleepCareBindTypeEnum.values()) {
            if (key.equals(ele.getKey())) {
                return ele.getValue();
            }
        }
        return null;
    }

    /**
     * 根据key获取该对象
     *
     * @param key key
     *
     * @return this enum
     */
    public static DmcSleepCareBindTypeEnum getEnum(Integer key) {
        for (DmcSleepCareBindTypeEnum ele : DmcSleepCareBindTypeEnum.values()) {
            if (key.equals(ele.getKey())) {
                return ele;
            }
        }
        return null;
    }

    /**
     * 获取List集合
     *
     * @return List list
     */
    public static List<DmcSleepCareBindTypeEnum> getList() {
        return Arrays.asList(DmcSleepCareBindTypeEnum.values());
    }

}
